#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

# 入口函数，相当于php的index.php
def main():
    # 配置环境，加载项目配置 settings
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings')
    # 加载命令行工具
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    # 执行命令行输入的参数
    execute_from_command_line(sys.argv)

# 如果定义了main函数，那么执行main函数
if __name__ == '__main__':
    main()
